import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [{
      path: '/login',
      name: 'login',
      component: () => import('../views/LoginView.vue'),
    }, {
    path: '/data-visual',
    name: 'data-visual',
    component: () => import('@/views/datavisual/index/index.vue'),
  },{
      path: '/',
      name: 'home',
      component: HomeView,
      // component: () => import('@/views/HomeView.vue'),
      redirect: '/dashboard',
      meta: {
        title: '首页',
      },
      children: [{
        path: 'dashboard',
        name: 'dashboard',
        meta: {title: '首页'},
        component: () => import('@/views/HomeView.vue')
      },{
        path: 'user',
        name: 'user',
        meta: {
          title: '用户管理'
        },children: [
          {
            path: 'profile',
            name: 'profile',
            meta: {
              title: '个人中心',
            },
            component: () => import('@/views/user/ProfileView.vue'),
          },
          {
            path: 'list',
            name: 'user-list',
            component: () => import('@/views/user/UserView.vue'),
            meta: {
              title: '用户列表'
            }
          }
        ]
      },{
        path: 'coach',
        name: 'coach',
        meta: {
          title: '教练管理'
        },children: [{
          path: 'list',
          name: 'coach-list',
          component: () => import('@/views/coach/CoachListView.vue'),
          meta: {
            title: '教练列表'
          }
        },{
          path: 'comment',
          name: 'coach-comment',
          component: () => import('@/views/coach/CoachCommentListView.vue'),
          meta: {
            title: '教练评论'
          }
        },{
          path: 'course',
          name: 'coach-course',
          component: () => import('@/views/coach/CoachScheduleView.vue'),
          meta: {
            title: '我的课程'
          }
        },{
          path: 'info',
          name: 'coach-info',
          component: () => import('@/views/coach/CoachInfoView.vue'),
          meta: {
            title: '我的资料'
          }
        },{
          path: 'course-detail',
          name: 'coach-course-detail',
          component: () => import('@/views/coach/CoachInfoView.vue'),
          meta: {
            title: '我的资料'
          }
        }]},{
        path: 'member',
        name: 'member',
        meta: {
          title: '会员管理'
        },children: [{
          path: 'list',
          name: 'member-list',
          component: () => import('@/views/member/MemberListView.vue'),
          meta: {
            title: '会员列表'
          }
        }]}, {
        path: 'resource',
        name: 'resource',
        meta: {
          title: '资源管理'
        },children: [{
          path: 'equipment',
          name: 'equipment',
          component: () => import('@/views/resource/EquipmentView.vue'),
          meta: {
            title: '设备列表'
          }
        },{
          path: 'venue',
          name: 'venue',
          component: () => import('@/views/resource/VenueView.vue'),
          meta: {
            title: '场地列表'
          }
        }]
      },{
        path: 'course',
        name: 'course',
        meta: {
          title: '课程管理'
        },children: [{
          path: 'category',
          name: 'course-category',
          component: () => import('@/views/course/CourseCategoryView.vue'),
          meta: {
            title: '课程分类'
          }
        },{
          path: 'list',
          name: 'course-list',
          component: () => import('@/views/course/CourseListView.vue'),
          meta: {
            title: '课程列表'
          }
        },{
          path: 'comment',
          name: 'course-comment',
          component: () => import('@/views/course/CourseCommentListView.vue'),
          meta: {
            title: '课程评论'
          }
        },{
          path: 'reserve',
          name: 'course-reserve',
          component: () => import('@/views/course/CourseReserveView.vue'),
          meta: {
            title: '课程预约'
          }
        },{
          path: 'plan',
          name: 'course-plan',
          component: () => import('@/views/course/CourseScheduleListView.vue'),
          meta: {
            title: '课程计划'
          }
        },{
          path: 'schedule-list',
          name: 'schedule-list',
          component: () => import('@/views/course/CourseScheduleListView.vue'),
          meta: {
            title: '安排列表'
          }},{
          path: 'schedule-detail',
          name: 'schedule-detail',
          component: () => import('@/views/course/CourseScheduleDetailView.vue'),
          meta: {
            title: '查看详情'
          }},{
          path: 'schedule',
          name: 'course-schedule',
          component: () => import('@/views/course/CourseScheduleView.vue'),
          meta: {
            title: '课程安排'
          }}]
      },{
        path: 'sys',
        meta: {
          title: '系统管理'
        },
        name: 'sys',
        children: [{
          path: 'news',
          name: 'news',
          component: () => import('@/views/settings/NewsView.vue'),
          meta: {
            title: '站内新闻'
          }
        }]
      },{
        path: 'log',
        meta: {
          title: '日志管理'
        },
        name: 'log',children: [{
          path: 'analysis',
          name: 'analysis',
          component: () => import('@/views/log/LogAnalysisView.vue'),
          meta: {
            title: '日志分析'
          }
        },{
          path: 'storage',
          name: 'storage',
          component: () => import('@/views/log/LogAnalysisView.vue'),
          meta: {
            title: '日志存储'
          }
        }]
      }]
    }
  ],
})

export default router
